/**
 * Copyright 2004 - 2006  Blue Bamboo International Inc. 
 *           All rights reserved.
 *
 *
 *  Blue Bamboo PROPRIETARY/CONFIDENTIAL.
 *
 */

/** 
 * File name:            DateFormatPreferencePage.java
 * 
 * Originally developed: Nick.Tan
 *
 * Create date :         Jul 19, 2007
 * 
 * Description:          The demo of the header on evey java code
 *                       These header could be configured in the Eclipse
 *                       The Eclipse template will come out next. 
 * 
 * Version:              0.1
 * 
 * Contributors:         
 * 
 * Modifications: 
 * name          version           reasons
 * 
 * $Log:$
 */
package com.googlecode.eclipse.navigatorext.preference;

import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;

import com.googlecode.eclipse.navigatorext.Activator;

/**
 * 
 */
public class DateFormatPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {

    public static final String DATE_PATTERN_KEY = "datePattern";
    public static final String DEFAULT_PATTERN = "yyyy-MM-dd HH:mm";

    public DateFormatPreferencePage() {
        super(GRID);
        setPreferenceStore(Activator.getDefault().getPreferenceStore());
        setDescription("Set up your date pattern.");
        initializeDefaults();
    }

    private void initializeDefaults() {
        IPreferenceStore store = getPreferenceStore();
        store.setDefault(DATE_PATTERN_KEY, DEFAULT_PATTERN);
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
     */
    @Override
    protected void createFieldEditors() {
        addField(new StringFieldEditor(DATE_PATTERN_KEY, "Date Pattern: ", getFieldEditorParent()));
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
     */
    public void init(IWorkbench workbench) {
    }

}
